package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.util.JdbcUtil;

@WebServlet("/WorkstationDelete")
public class WorkstationDelete extends HttpServlet{
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String wname = request.getParameter("wid");
    	JdbcUtil jdbc = new JdbcUtil();
	    String sql ="delete from workstation where wid=?";
	  try{
	    jdbc.updatePreparedStatement(sql, wname);
	    PrintWriter out = response.getWriter();
		out.print(1);
		out.flush();
		out.close();
	  }catch(Exception e){
		  e.printStackTrace();
		  request.getRequestDispatcher("error.jsp").forward(request, response);
	  }
	}
	
}
